import mongoose from 'mongoose';

const memberSchema = new mongoose.Schema({
    username: {
        type: String,
        required: true,
        unique: true
    },
    password: {
        type: String,
        required: true
    },
    fullName: {
        type: String,
        required: false
    },
    avatar: {
        type: String,
        required: false
    },
    balance: {
        type: Number,
        required: false,
        default: 0.00
    },
    frozenAmount: { // 冻结金额
        type: Number,
        required: false,
        default: 0.00
    },
    accumulatedConsumption: { // 累计消费
        type: Number,
        required: false,
        default: 0.00
    },
    draws: {    // 盲盒抽奖次数
        type: Number,
        default: 0
    },
    dateOfBirth: {
        type: Date,
        required: false
    },
    address: {
        type: String
    },
    // address: {
    //     street: String,
    //     city: String,
    //     state: String,
    //     zipCode: String,
    //     country: String
    // },
    phoneNumber: String,
    level: {
        type: String,
        default: '1',
        enum: ['1', '2', '3']
    },
    isActive: {
        type: Boolean,
        default: true
    },
    createdAt: {
        type: String,
    },
    updatedAt: {
        type: String,
    },
    // 可以根据您的需求添加更多字段
});

const Member = mongoose.model('Member', memberSchema);

export default Member;
